<?php
// +----------------------------------------------------------------------
// | 麦沃德科技赋能开发者，助力中小企业发展
// +----------------------------------------------------------------------
// | Copyright (c) 2017～2024  www.wdadmin.cn    All rights reserved.
// +----------------------------------------------------------------------
// | Wdadmin系统产品软件并不是自由软件，不加密，并不代表开源，未经许可不可自由转售和商用
// +----------------------------------------------------------------------
// | Author: MY WORLD Team <bd@maiwd.cn>   www.wdadmin.cn
// +----------------------------------------------------------------------
/**
 * Class Wallet
 * Desc  钱包控制器
 * Create on 2024/10/22 15:26
 * Create by wangyafang
 */

namespace app\api\controller\wddj\trailer;


use app\api\model\wddj\User;
use app\common\controller\Api;

class Wallet extends Api
{
    protected $noNeedLogin = [''];
    protected $noNeedRight = ['center'];
    protected $driverObj = null;

    public function _initialize()
    {
        parent::_initialize();
        $wechat_id = User::getWechatId($this->auth->id);
        $driverObj = (new \app\api\model\wddj\trailer\Driver())->where('wechat_id',$wechat_id)->find();
        if (!$driverObj) {
            $this->error('不是司机，没有权限,请先认证');
        }
        $this->driverObj = $driverObj;
    }

    /**
     * Desc 钱包中心
     * Create on 2024/10/22 15:27
     * Create by wangyafang
     */
    public function center()
    {
        if(!$this->request->isGet()) {
            $this->error('请求类型错误');
        }

        $data = \app\api\model\wddj\trailer\Withdrawal::getWithdrawalData($this->driverObj);
        $this->success('请求成功',$data);
    }
}



 